package com.xlf.service.blog.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;

import com.xlf.common.core.annotation.Anonymous;
import com.xlf.common.core.constant.Constants;
import com.xlf.common.core.constant.UserConstants;
import com.xlf.common.core.enums.BusinessType;
import com.xlf.common.core.pojo.mode.AjaxResult;
import com.xlf.common.core.pojo.mode.BaseController;
import com.xlf.common.core.util.page.TableDataInfo;
import com.xlf.service.blog.domain.Type;
import com.xlf.service.blog.service.TypeService;
import lombok.extern.java.Log;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/blog/type")
public class TypeController extends BaseController {

    @Resource
    TypeService typeService;

    @Anonymous
    @GetMapping("/list")
    AjaxResult getList(){
        LambdaQueryWrapper<Type> typeLambdaQueryWrapper = new LambdaQueryWrapper<>();
        typeLambdaQueryWrapper.orderByAsc(Type::getSort);
        typeLambdaQueryWrapper.eq(Type::getStatus, Constants.NORMAL);
        List<Type> list = typeService.list(typeLambdaQueryWrapper);
        return success(list);
    }

}
